<?php
/*
	我的足迹
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$return['setting']=$this->plugin_setting('basic');
	$return['list']=array();
	set_html('title','参与游戏');
	exi($return);
}
// js 获取数据
if($_RQ['op']=='getfeelog'){
	$gameid=intval($_RQ['gameid']);
	$noshare=intval($_RQ['noshare']);
	$params=array(
		'uniacid'=>$_SESSION['uniacid'],
		'game_id'=>$gameid,
	);
	$return['params']['game_id']=$gameid;
	if($noshare){
		$params['isshare']=0;
		$return['params']['noshare']=$noshare;
	}else{
		$myfeelog=pdo_get('jy_weishop_game_feelog',array('pin_id'=>0,'mid'=>$_SESSION['uid'],'game_id'=>$gameid,'uniacid'=>$_SESSION['uniacid']));
		$params['isshare']=1;
		$params['pin_id']=$myfeelog['id'];
		$myfeelog['createtime']=date('Y/m/d H:i:s',$myfeelog['createtime']);
		$myfeelog['member']=pdo_get('core_members',array('id'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']), array('nickname', 'avatar'));
		$return['myfeelog']=$myfeelog;
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$return['list']=pdo_getslice('jy_weishop_game_feelog',$params,array($pindex,$psize),$total,array(),'','createtime desc');
	foreach($return['list'] as $k=>&$item){
		$item['createtime']=date('Y/m/d H:i:s',$item['createtime']);
		$item['sharefee']=pdo_getsum('jy_weishop_game_feelog',array('pin_id'=>$item['id'],'game_id'=>$game['id'],'uniacid'=>$_SESSION['uniacid']),'fee');
		$item['allfee']=$item['fee'] + $item['sharefee'];
		$item['member']=pdo_get('core_members',array('id'=>$item['mid'],'uniacid'=>$_SESSION['uniacid']), array('nickname', 'avatar'));
		$item['isgetred']=pdo_getcolumn('jy_weishop_game_getlog',array('game_id'=>$gameid,'mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']),'id');
	}
	exi($return);
}	